<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>
        .active {
            width: 100px;
            height: 100px;
            background-color: tan;
        }
        
        .current {
            color: red;
        }
        
        .myFont {
            font-size: 20px;
            font-weight: 800;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 
            :class是对象,键名就是样式名，对应值是布尔值。决定是否有这个样式
            如果有默认样式直接写class
         -->
        <div :class="{'active':bool1 , 'current':bool2 }" class="myFont">111</div>
        <div :class="{'active':1==1 , 'current':num>5 }" class="myFont">222</div>
        <hr>
        <!--  :class可以是一个数组-->
        <div :class="['active', 'current']" class="myFont">333</div>
        <div :class="classArr" class="myFont">444</div>
        <hr>
        <!-- :class的值可以是一个三元运算符-->
        <div :class="num>15?'active':'current'">555</div>
        <div :class="num>15?'active':''">666</div>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                bool1: true,
                bool2: false,
                classArr: ['active', 'current'],
                num: 10
            }
        })
    </script>
</body>

</html>